package vip.fkandy.mybatis.dao;

import org.apache.ibatis.annotations.Param;
import vip.fkandy.mybatis.bean.Employee;

import java.util.List;

/**
 * 动态SQL测试Mapper
 */
public interface EmployeeMapperDynamicSQL {
    /**
     * 查询员工，模拟IF条件
     *
     * @param employee
     * @return
     */
    List<Employee> getEmpsByConditionIf(Employee employee);

    /**
     * 测试trim()
     *
     * @param employee
     * @return
     */
    List<Employee> getEmpsByConditionTrim(Employee employee);

    /**
     * 测试Choose
     *
     * @param employee
     * @return
     */
    List<Employee> getEmpsByConditionChoose(Employee employee);

    /**
     * 测试Set,<set></set>标签会去掉多余的逗号
     *
     * @param employee
     */
    void updateEmp(Employee employee);

    /**
     * 测试foreach
     *
     * @param ids
     * @return
     */
    List<Employee> getEmpsByConditionForeach(@Param("ids") List<Integer> ids);

    /**
     * 测试批量保存
     *
     * @param emps
     */
    void addEmps(@Param("emps") List<Employee> emps);

    /**
     * 测试Mybatis内置参数
     *
     * @param employee
     * @return
     */
    List<Employee> getEmpsTestInnerParameter(Employee employee);
}

